﻿using System.Linq.Expressions;


namespace SBlogCore.Common.DatabaseAccessor.Repositorys.EFCore
{
    public  partial interface IRepository<TEntity> where TEntity : class, IBaseEntity
    {
        void Delete(TEntity entity);
        void DeleteRange(IEnumerable<TEntity> entityParams);
        Task DeleteAsync(TEntity entity);
        /// <summary>
        /// 异步删除立即保存
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> DeleteNowAsync(TEntity entity);
        /// <summary>
        /// 删除立即保存
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        int DeleteNow(TEntity entity);
        /// <summary>
        /// 异步批量删除立即保存
        /// </summary>
        /// <param name="entityParams"></param>
        /// <returns></returns>
        Task<int> DeleteRangeNowAsync(IEnumerable<TEntity> entityParams);
        /// <summary>
        /// 批量删除立即保存
        /// </summary>
        /// <param name="entityParams"></param>
        /// <returns></returns>
        int DeleteRangeNow(IEnumerable<TEntity> entityParams);
        ///// <summary>
        ///// 按条件删除立即保存
        ///// </summary>
        ///// <param name="exp"></param>
        ///// <returns></returns>
        //Task<int> DeleteNowAsync(Expression<Func<TEntity, bool>> exp);

        Task<int> ExecuteDeleteAsync(Expression<Func<TEntity, bool>> exp);
        int ExecuteDelete(Expression<Func<TEntity, bool>> exp);
    }
}
